package butines.game.steering.behavior;

import butines.core.math2d.Vector2D;
import butines.game.steering.SteerLibrary;
import butines.game.steering.Vehicle;

public class OffsetPursuitBehavior extends AbstractBehavior {

	private Vehicle owner;
	private Vehicle leader;
	private Vector2D offset = new Vector2D();
	private Vector2D steeringForce = new Vector2D();

	public OffsetPursuitBehavior(Vehicle owner) {
		this.owner = owner;
	}

	@Override
	public Vector2D calculate() {
		steeringForce.set(0, 0);
		if (leader != null) {
			SteerLibrary.offsetPursuit(steeringForce, owner, leader, offset);
		}
		return steeringForce;
	}

	public Vehicle getLeader() {
		return leader;
	}

	public void setLeader(Vehicle leader) {
		this.leader = leader;
	}

	public Vector2D getOffset() {
		return offset;
	}

	public void setOffset(Vector2D offset) {
		this.offset.set(offset);
	}

	public Vector2D getSteeringForce() {
		return steeringForce;
	}

}
